package hotgammon.domain;

public class DeltamonMove implements MoveStrategy{
	
	public boolean move(Board board, Game game, Location from, Location to) {
		Color colorFrom = game.getColor(from);
		Color colorTo = game.getColor(to);
		Color colorCurrent = game.getPlayerInTurn();
		
		if(colorFrom == Color.NONE)
			return false;
		
		if(colorCurrent == Color.NONE)
			return false;
		
		if(colorFrom != colorCurrent)
			return false;
		
		if(colorTo != Color.NONE && colorFrom != colorTo)
			return false;
		
		if(game.getNumberOfMovesLeft() == 0 )
			return false;
		
		if(colorCurrent == Color.BLACK && Location.distance(from, to) < 0)
			return false;
		
		if(colorCurrent == Color.RED && Location.distance(from, to) > 0)
			return false;
		
		return true;
	}
}
